# pathlib模块用于进行路径拼接转换等操作
from pathlib import Path
from ..deal_file.dealSampleSheet import dealSampleSheet
def dealDir(inputdir,_samples):
    # 创建文件夹
    path = Path(inputdir)
    _bclDir = path.absolute()
    _runid = _bclDir.name
    out = Path(f'./{_runid}')
    _outdir = out.absolute()
    _fqDir = _outdir / Path('fastq')
    _shellDir = _outdir / Path('shell')
    _bwa_shellDir = _shellDir / Path('bwa')
    _cnv_shellDir = _shellDir / Path('cnv')
    _kk_shellDir = _shellDir / Path('kraken')
    _rgi_shellDir = _shellDir / Path('rgi')
    _myco_shellDir = _shellDir / Path('myco')
    _L01Dir = _outdir / Path('L01')
    if not _outdir.exists():
        _outdir.mkdir()
        _L01Dir.mkdir()
        _fqDir.mkdir()
        _shellDir.mkdir()
        _bwa_shellDir.mkdir()
        _cnv_shellDir.mkdir()
        _kk_shellDir.mkdir()
        _rgi_shellDir.mkdir()
        _myco_shellDir.mkdir()
    # _samplesDir = {}
    for i, e in _samples.items():
      _samplesDir = Path(f'./{_runid}/{e}').absolute()
      if not _samplesDir.exists():
        _samplesDir.mkdir()
    return (_bclDir,_runid,_outdir,_fqDir,_shellDir,_L01Dir)